
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui"
        xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
        <title>Admin Panel</title>
</h:head>
<h:body style="background:#2A2D30;">

<h:form>
<p:panel style="height:400px">
                <p:panel header="New Flight Form">
                        <h:panelGrid columns="3" id="add_flightGrid">
                                <h:outputLabel for="fDestination">Destination:</h:outputLabel>
                                <p:inputText id="fDestination" value="#{flightbean.flightdto.fDestination}" />
                                <p:message for="fDestination" />



                                <h:outputLabel for="fDeparture">From:</h:outputLabel>
                                <p:inputText id="fDeparture"
                                        value="#{flightbean.flightdto.fDeparture}" />
                                <p:message for="fDeparture" />

                                <h:outputLabel for="fNumber">Air Line:</h:outputLabel>
                                <p:inputText id="fNumber" value="#{flightbean.flightdto.fNumber}" />
                                <p:message for="fNumber" />
                                
                                <h:outputLabel for="fPrice">Price:</h:outputLabel>
                                <p:inputText id="fPrice" value="#{flightbean.flightdto.fPrice}" />
                                <p:message for="fPrice" />
                                                       

                        </h:panelGrid>
                        <p:commandButton id="addflight" value="Add Flight"
                                update="add_flightGrid,successDlg" title="Complete"
                                action="#{flightbean.register()}"
                                oncomplete="PF('successDialog').show()" />

                </p:panel>
                <p:dialog header="Status" widgetVar="successDialog" resizable="false"
                        id="successDlg" showEffect="fade" hideEffect="drop" modal="true"
                        draggable="no">

                        <h:outputText rendered="#{(empty flightbean.flightdto.fDestination)}"
                                value="Error!No data added" />

                        <p:panel rendered="#{(not empty flightbean.flightdto.fDestination)}">
                                <h:panelGrid columns="3">
                                        <h:outputText value="The Flight from'"/>
                                        <h:outputText value="#{(flightbean.flightdto.fDeparture)}" />
                                        <h:outputText value="' to '" />
                                        <h:outputText value="#{(flightbean.flightdto.fDestination)}" />
                                        <h:outputText value="' is  added successfully" />
                                </h:panelGrid>
                        </p:panel>
                        <h:form>
                                <br />
                                <p:button value="OK!"
                                        outcome="flight.xhtml" />
                              
                         </h:form>
                </p:dialog>
                <p:panel>
      <p:button value="back" outcome="index.xhtml" />
     
                </p:panel>
</p:panel>
        </h:form>
        
</h:body>
</html>